#include <eosio/eosio.hpp>

using namespace eosio;
using std::string;

class[[eosio::contract("yktask")]] yktask : public contract
{
    public:
        using contract::contract;
        yktask(name receiver, name code, datastream<const char *> ds) : contract(receiver, code, ds) {}

        // 表的定义
        // 任务表
        struct [[eosio::table]] task
        {
            uint64_t  taskid;
            name      issuer;
            name      hunter;
            uint8_t   status;// 0 - 发布； 1 - 接受； 2- 提交； 3- 确认
            string    desc;
            string    comment;
            string    tasktime;
            uint64_t  bonus;//奖金
            auto primary_key() const { return taskid; }
            
            //EOSLIB_SERIALIZE( task, (username)(amount))
        };

        typedef eosio::multi_index<"tasks"_n, task> tasks;

        // 定义动作 
        [[eosio::action]]
        void issuetask(name admin, name issuer, string desc, uint64_t bonus);
        [[eosio::action]]
        void taketask(name admin, uint64_t taskid, name hunter);
        [[eosio::action]]
        void committask(name admin, uint64_t taskid, name hunter);
        [[eosio::action]]
        void confirmtask(name admin, uint64_t taskid, name issuer, uint8_t status, string comment);
        [[eosio::action]]
        const task & querytask(name admin, uint64_t taskid);

    private:

};
